package com.jinmdz.fmis.mapper.mapper;

import com.jinmdz.fmis.mapper.entity.MournCeremonyHallEntity;
import com.jinmdz.fmis.mapper.mapper.provider.MournCeremonyHallProvider;
import org.apache.ibatis.annotations.*;

import java.util.ArrayList;

/**
 * 悼念仪式大厅表Mapper
 *
 * @author generator
 * @date 2020-03-13 11:27
 */
public interface MournCeremonyHallMapper {

    /**
     * 增加MournCeremonyHall
     *
     * @param entity 数据实体
     * @return
     * @author generator
     * @date 2020-03-13 11:27
     */
    @InsertProvider(type = MournCeremonyHallProvider.class, method = "insertMournCeremonyHall")
    @Options(useGeneratedKeys = true, keyProperty = "entity.id", keyColumn = "id")
    void insertMournCeremonyHall(@Param("entity") MournCeremonyHallEntity entity);

    /**
     * 删除MournCeremonyHall
     *
     * @param id             主键
     * @param modifiedUserId 修改用户外键
     * @param version        版本号
     * @return
     * @author generator
     * @date 2020-03-13 11:27
     */
    @Update(" update mourn_ceremony_hall set deleted = 1,modified_user_id = #{modifiedUserId},version = unix_timestamp(now()) where id = #{id} and version = #{version} and unmodified = 0 and deleted = 0 ")
    void deletedForMournCeremonyHall(@Param("id") Integer id, @Param("modifiedUserId") Integer modifiedUserId, @Param("version") Long version);

    /**
     * 修改MournCeremonyHall
     *
     * @param entity 数据实体
     * @return
     * @author generator
     * @date 2020-03-13 11:27
     */
    @UpdateProvider(type = MournCeremonyHallProvider.class, method = "updateMournCeremonyHall")
    void updateMournCeremonyHall(@Param("entity") MournCeremonyHallEntity entity);

    /**
     * 查询MournCeremonyHall实体
     *
     * @param id 主键
     * @return MournCeremonyHallEntity
     * @author generator
     * @date 2020-03-13 11:27
     */
    @Select(" select id,deleted,hall_type_code,hall_code,hall_name,hall_describe,hall_state,as_wake,as_farewell,disable_state,sort,remark,funeral_parlour_code,create_user_id,gmt_create,unmodified,modified_user_id,gmt_modified,version from mourn_ceremony_hall where id = #{id} and deleted = 0 limit 1 ")
    MournCeremonyHallEntity getMournCeremonyHallById(@Param("id") Integer id);

    /**
     * 查询MournCeremonyHall列表
     *
     * @param entity 数据实体
     * @return MournCeremonyHallEntity
     * @author generator
     * @date 2020-03-13 11:27
     */
    @SelectProvider(type = MournCeremonyHallProvider.class, method = "listMournCeremonyHall")
    ArrayList<MournCeremonyHallEntity> listMournCeremonyHall(@Param("entity") MournCeremonyHallEntity entity);
}